import Vue from 'vue'
import zh_CN from 'vee-validate/dist/locale/zh_CN'
import VeeValiate from 'vee-validate'
import { values } from 'lodash'
Vue.use(VeeValiate)

//表单验证规则
VeeValiate.Validator.localize('zh_CN',{
  messages:{
    ...zh_CN.messages,
    is:(field)=>`${field}必须密码相同` //修改内置规则的message,让确认密码和密码相同
  },
  attributes:{
     phone:'手机号', //给校验field的属性名映射中文名称
     code:"验证码",
     password:'密码',
     password2:'确认密码',
     agree:'协议',
  }

})


//自定义校验规则
VeeValiate.Validator.extend('agree',{
  validate:value=>{
    return value
  },
  getMessage:field=>field + '必须同意'
})
